import java.util.ArrayList;
import java.util.List;
import java.util.function.Consumer;
import java.util.stream.Stream;

public class SomeSampleList {
    public static void main(String[] args) {
        List<Integer> one = new ArrayList<>();
        one.add(1);
        one.add(2);
        one.add(3);
        one.add(4);
        one.add(5);
        one.add(6);
        one.add(7);
        one.add(8);
        one.stream().findFirst().ifPresent(integer -> System.out.println(integer));
        List<Integer> two = new ArrayList<>();
        two.add(3);
        two.add(4);
        two.add(5);
        two.add(6);

        Stream.of(50, 60, 70).findFirst()
                .ifPresent(System.out::println);



        one.forEach(x -> {
            if (two.contains(x)) {
                x = 999999;

            }
            System.out.println(x);
        });

    }
}
